<template>
  <div class="login-page">
    <nav-bar></nav-bar>
    <div class="login-content">
      <div class="login-container">
        <div class="login-left">
          <img src="@/assets/register-illustration.png" alt="登录插图" class="large-illustration">
        </div>
        <div class="login-right">
          <h2>欢迎回到学了喵</h2>
          <p class="login-desc">请登录您的账号继续学习</p>
          
          <div class="custom-input-container">
            <input 
              v-model="account"
              class="custom-input" 
              placeholder="请输入手机号/邮箱" 
              maxlength="30"
            />
          </div>
          
          <div class="custom-input-container">
            <input 
              v-model="password"
              class="custom-input" 
              type="password"
              placeholder="请输入密码" 
            />
          </div>
          
          <div class="remember-forgot">
            <label class="remember">
              <input type="checkbox" v-model="rememberMe">
              <span>记住我</span>
            </label>
            <a href="#" class="forgot">忘记密码?</a>
          </div>
          
          <button class="login-btn" @click="handleLogin">登录</button>
          
          <div class="other-login">
            <div class="divider">其他登录方式</div>
            <div class="social-login">
              <button class="social-btn qq">Q</button>
              <button class="social-btn wechat">W</button>
              <button class="social-btn email">E</button>
            </div>
          </div>
          
          <div class="register-link">
            还没有账号? <router-link to="/register">立即注册</router-link>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import NavBar from '@/components/NavBar.vue'

export default {
  name: 'LoginView',
  components: {
    NavBar
  },
  data() {
    return {
      account: '',
      password: '',
      rememberMe: false
    }
  },
  methods: {
    handleLogin() {
      // 这里可以添加登录验证逻辑
      this.$router.push('/')  // 跳转到主页
    }
  }
}
</script>

<style scoped>
.login-page {
  width: 100%;
  min-height: 100vh;
  background-color: #fff;
}

.login-content {
  padding-top: 80px;
}

.login-container {
  width: 1000px;
  margin: 0 auto;
  display: flex;
  gap: 60px;
  align-items: center;
}

.login-left {
  flex: 1;
}

.login-left img {
  width: 100%;
  max-width: 500px;
}

.large-illustration {
  width: 120%;
  max-width: 600px;
  margin-left: -40px;
}

.login-right {
  flex: 1;
  padding: 40px;
  max-width: 400px;
}

h2 {
  font-size: 32px;
  color: #333;
  margin-bottom: 15px;
  font-weight: 500;
}

.login-desc {
  color: #666;
  font-size: 14px;
  margin-bottom: 30px;
}

.custom-input-container {
  margin: 20px 0;
  width: 100%;
}

.custom-input {
  width: 100%;
  height: 45px;
  border: 1px solid #333;
  border-radius: 0;
  padding: 0 15px;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
}

.custom-input:focus {
  border-color: #6d28d2;
}

.remember-forgot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
}

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 14px;
}

.forgot {
  color: #6d28d2;
  text-decoration: none;
  font-size: 14px;
}

.login-btn {
  width: 100%;
  height: 45px;
  background: #6d28d2;
  color: white;
  border: none;
  font-size: 16px;
  cursor: pointer;
  margin-top: 10px;
}

.login-btn:hover {
  opacity: 0.9;
}

.other-login {
  margin: 30px 0;
}

.divider {
  text-align: center;
  position: relative;
  color: #999;
  font-size: 14px;
  margin: 20px 0;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background-color: #ddd;
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

.social-login {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 20px;
}

.social-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
}

.social-btn:hover {
  border-color: #6d28d2;
  transform: translateY(-2px);
}

.register-link {
  text-align: center;
  margin-top: 20px;
  color: #666;
  font-size: 14px;
}

.register-link a {
  color: #6d28d2;
  text-decoration: none;
}
</style>